package bbs;

import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class BBSFactory {
	
	//드라이버를 로딩, Connection 정보를 갖고 있음.
	private static SqlSessionFactory factory;
	
	static{
		try {
			//config.xml 읽어들여서 factory를 만든다?
			Reader reader = Resources.getResourceAsReader("config.xml");
			factory = new SqlSessionFactoryBuilder().build(reader);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static SqlSessionFactory getFactory(){
		return factory;
	}
	
}
